import type { PageParams, PageResult } from '@/types/global'
import type { BannerItem, CategoryItem, GuessLikeItem, HotItem } from '@/types/home'
import { http } from '@/utils/http'
export const useHomeApi = () => {
    return {
        /**
         * 首页轮播图
         * @param data 1为首页，2为其他
         * @returns 请求首页轮播图数据
         */
        getBanner: (data: 1 | 2) => {
            return http<BannerItem[]>({
                method: 'GET',
                url: '/home/banner',
                data: {
                    distributionSite: data
                }
            })
        },
        /**
         * 分类模块
         * @returns 请求分类信息
         */
        getCategory: () => {
            return http<CategoryItem[]>({
                method: 'GET',
                url: '/home/category/mutli'
            })
        },
        /**
         * 热门推荐
         * @returns 请求热门推荐
         */
        getHotPanel: () => {
            return http<HotItem[]>({
                method: 'GET',
                url: '/home/hot/mutli'
            })
        },
        getGuessLike: (data?: PageParams) => {
            return http<PageResult<GuessLikeItem>>({
                method: 'GET',
                url: '/home/goods/guessLike',
                data
            })
        }
    }
} 